home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v9n04.arc
/
USEHELLO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-01-30
|
2KB
|
98 lines
USEHELLO.PAS
PROGRAM Use_Hello;
(* Conditional compilation directives allow this
code to compile under _either_ TP5.5 or QP *)
{$IFDEF ver55}
{$DEFINE TP}
{$ELSE}
{$IFDEF ver10}
{$DEFINE QP}
{$ELSE}
CRASH HERE -- neither Turbo nor Quick
{$ENDIF}
{$ENDIF}
USES Crt,hello2;
TYPE
MMpt = ^MovingMessage;
MovingMessage = OBJECT(ColorMessage)
width : Byte;
{$IFDEF TP}CONSTRUCTOR{$ELSE}PROCEDURE{$ENDIF}
InitMM(iS : String; iX, iY, iColor, iWid : Byte);
PROCEDURE Say; {$IFDEF TP}virtual;{$ELSE}override;{$ENDIF}
END;
{$IFDEF TP}CONSTRUCTOR{$ELSE}PROCEDURE{$ENDIF}
MovingMessage.InitMM(iS : String; iX, iY, iColor, iWid : Byte);
BEGIN
{$IFDEF TP} ColorMessage.InitCM(iS, iX, iY, iColor);
{$ELSE} self.InitCM(iS, iX, iY, iColor);
{$ENDIF}
self.width := iWid;
END;
PROCEDURE MovingMessage.Say;
VAR marquee : String;
P : byte;
BEGIN
FillChar(marquee, SizeOf(marquee), ' ');
marquee[0] := chr(self.width);
P := 1;
self.SaveColor := TextAttr;
TextAttr := self.color;
REPEAT
GotoXY(self.X,self.Y);
Write(marquee);
MOVE(marquee[2], marquee[1],pred(self.width));
marquee[self.width] := self.words[P];
P := succ(P MOD length(self.words));
sound(250); Delay(5); NoSound;
delay(95);
UNTIL KeyPressed;
TextAttr := self.SaveColor;
END;
VAR
TheList : List;
{$IFDEF QP}
tempMs : MsPt;
tempPM : PMpt;
tempCM : CMpt;
tempMM : MMpt;
{$ENDIF}
BEGIN
ClrScr;
{$IFDEF QP} New(TheList); {$ENDIF}
TheList.Init;
{$IFDEF TP}
TheList.Add(new(MMpt, InitMM('Dow Jones up 1000! Film at 11. ',
10,15,$1C,60)));
TheList.Add(new(CMpt, InitCM('Hello in living color!',20,10,$4E)));
TheList.Add(new(PMpt, InitPM('Hello from down under',1,25)));
TheList.Add(new(MsPt, Init('Hello, World!')));
{$ELSE}
New(tempMM); New(tempMM^);
tempMM^.InitMM('Dow Jones up 1000! Film at 11. ',10,15,$1C,60);
TheList.Add(TempMM);
New(tempCM); New(tempCM^);
tempCM^.InitCM('Hello in living color!',20,10,$4E);
TheList.Add(TempCM);
New(tempPM); New(tempPM^);
tempPM^.InitPM('Hello from down under',1,25);
TheList.Add(TempPM);
New(tempMs); New(tempMs^);
tempMs^.Init('Hello, World!');
TheList.Add(TempMs);
{$ENDIF}
TheList.Show;
END.